package com.sys.SysAquaticSpecies.controller;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.sys.common.annotation.Log;
import com.sys.common.core.controller.BaseController;
import com.sys.common.core.domain.AjaxResult;
import com.sys.common.enums.BusinessType;
import com.sys.SysAquaticSpecies.domain.SysAquaticSpecies;
import com.sys.SysAquaticSpecies.service.ISysAquaticSpeciesService;
import com.sys.common.utils.poi.ExcelUtil;
import com.sys.common.core.page.TableDataInfo;

/**
 * 养殖生物信息Controller
 * 
 * @author sys
 * @date 2025-09-04
 */
@RestController
@RequestMapping("/SysAquaticSpecies/SysAquaticSpecies")
public class SysAquaticSpeciesController extends BaseController
{
    @Autowired
    private ISysAquaticSpeciesService sysAquaticSpeciesService;

    /**
     * 查询养殖生物信息列表
     */
    @PreAuthorize("@ss.hasPermi('SysAquaticSpecies:SysAquaticSpecies:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysAquaticSpecies sysAquaticSpecies)
    {
        startPage();

        List<SysAquaticSpecies> list = sysAquaticSpeciesService.selectSysAquaticSpeciesList(sysAquaticSpecies);
        return getDataTable(list);
    }

    /**
     * 导出养殖生物信息列表
     */
    @PreAuthorize("@ss.hasPermi('SysAquaticSpecies:SysAquaticSpecies:export')")
    @Log(title = "养殖生物信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysAquaticSpecies sysAquaticSpecies)
    {
        List<SysAquaticSpecies> list = sysAquaticSpeciesService.selectSysAquaticSpeciesList(sysAquaticSpecies);
        ExcelUtil<SysAquaticSpecies> util = new ExcelUtil<SysAquaticSpecies>(SysAquaticSpecies.class);
        util.exportExcel(response, list, "养殖生物信息数据");
    }

    /**
     * 获取养殖生物信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('SysAquaticSpecies:SysAquaticSpecies:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sysAquaticSpeciesService.selectSysAquaticSpeciesById(id));
    }

    /**
     * 新增养殖生物信息
     */
    @PreAuthorize("@ss.hasPermi('SysAquaticSpecies:SysAquaticSpecies:add')")
    @Log(title = "养殖生物信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@Validated @RequestBody SysAquaticSpecies sysAquaticSpecies)
    {
        return toAjax(sysAquaticSpeciesService.insertSysAquaticSpecies(sysAquaticSpecies));
    }

    /**
     * 修改养殖生物信息
     */
    @PreAuthorize("@ss.hasPermi('SysAquaticSpecies:SysAquaticSpecies:edit')")
    @Log(title = "养殖生物信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysAquaticSpecies sysAquaticSpecies)
    {
        return toAjax(sysAquaticSpeciesService.updateSysAquaticSpecies(sysAquaticSpecies));
    }

    /**
     * 删除养殖生物信息
     */
    @PreAuthorize("@ss.hasPermi('SysAquaticSpecies:SysAquaticSpecies:remove')")
    @Log(title = "养殖生物信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysAquaticSpeciesService.deleteSysAquaticSpeciesByIds(ids));
    }
}
